package com.yzt.zhuju.utils;

import com.yzt.zhuju.R;

import java.util.Random;

/**
 * author : bob
 * date   : 2022/12/2
 * desc   :筛子工具类
 */
public class DiceUtil {

    private static final int[] DRAWABLE_ID = {
            R.drawable.game_dice_1,
            R.drawable.game_dice_2,
            R.drawable.game_dice_3,
            R.drawable.game_dice_4,
            R.drawable.game_dice_5,
            R.drawable.game_dice_6
    };

    public static int getDrawableId(int gameResult) {

        gameResult = gameResult - 1;
        if (gameResult < 0 || gameResult >= DRAWABLE_ID.length) {
            return -1;
        }
        return DRAWABLE_ID[gameResult];
    }

    public static int getRandomResult() {
        Random rand = new Random();
        return rand.nextInt(6) + 1;
    }

    public static String getShaiZiLabel() {
        return "[摇骰子]";
    }

}
